package com.ambimmort.shj.action.Lsl;

import cn.net.greenet.generalfile.logic.GeneralFileProcess;
import com.ambimmort.shj.service.LslService.RSUService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by ma on 2015/7/30.
 */
@Controller("/action/common/upload_protocol_bank.do")
public class UplodProtocolBank2DB {
    @Autowired
    private RSUService rsuService;

    @RequestMapping("/action/common/upload_protocol_bank.do")
    @ResponseBody
    public boolean action_crm(
            HttpServletRequest request, @RequestParam("path") String path,@RequestParam("MessageType") String MessageType,
            @RequestParam("policy_instance") String policy_instance) {
        GeneralFileProcess pro = new GeneralFileProcess(path, MessageType, policy_instance);
        path = pro.saveFile(request, "");
        try {
            rsuService.uplodProtocolBank2DB(path, MessageType, policy_instance, pro);
            return true;
        } catch (Throwable throwable) {
            throwable.printStackTrace();
            return false;
        }
    }

}
